package com.xwaf.platform.web.controller.x;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xwaf.platform.common.utils.annotation.CurrentLimitRequired;
import com.xwaf.platform.common.web.BaseController;
import com.xwaf.platform.system.api.entity.auth.Company;
import com.xwaf.platform.system.api.service.auth.CompanyService;

import io.swagger.annotations.Api;
import springfox.documentation.annotations.ApiIgnore;

@ApiIgnore
@RestController
@Api(tags = "限流测试", hidden = true)
@RequestMapping(value = "/x/limit")
public class LimitController extends BaseController {
	private static Logger logger = LoggerFactory.getLogger(LimitController.class);

	@Autowired
	private CompanyService companyService;

	@CurrentLimitRequired(limit = 2)
	@RequestMapping("limitMax")
	public String limitMax(HttpServletRequest request) {
		Company company = companyService.selectLimitMax();
		System.out.println(company.getEmail());
		logger.info("....");
		return "ok";
	}
}
